package com.github.shiqiyue.app.config.security.sapi;


import com.github.shiqiyue.app.common.result.Result;
import com.github.shiqiyue.app.common.utils.ResponseUtils;
import org.springframework.http.ResponseEntity;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/***
 * 后台用户登出成功处理
 * @author wenyao.wu
 * @date 2019/7/11
 */
public class SapiLogoutSuccessHandler implements LogoutSuccessHandler {
    @Override
    public void onLogoutSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException {
        ResponseUtils.populateResponse(ResponseEntity.ok(Result.success(null)), httpServletResponse);
    }
}
